﻿
<!DOCTYPE html>
<html>
<head>
    <meta name="viewport" content="width=device-width" />
    <title>@ViewBag.Title</title>
    <link href="~/Content/bootstrap.min.css" rel="stylesheet" />
    <link rel="shortcut icon" href="" type="../../../../Content/backSys/image/png">
    <link href="../../../../Content/backSys/css/style.css" rel="stylesheet">
    <link href="../../../../Content/backSys/css/style-responsive.css" rel="stylesheet">

    <meta name="viewport" content="width=device-width" />
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
    <meta http-equiv="content-security-policy" content="upgrade-insecure-requests" />
    <meta name="description" content="">
    <meta name="author" content="ThemeBucket">
    @*<link href="~/Content/font" rel="stylesheet" />*@
    @if (IsSectionDefined("CssLink"))
    {
        @RenderSection("CssLink");
    }
    @if (IsSectionDefined("Style"))
    {
        @RenderSection("Style");
    }



</head>
<body>

    @RenderBody()


    @*<script src="~/Scripts/jquery-3.2.1.min.js"></script>
        <script src="~/Scripts/bootstrap.min.js"></script>*@
    <script src="../../../../Content/backSys/js/jquery-1.10.2.min.js"></script>
    <script src="../../../../Content/backSys/js/bootstrap.min.js"></script>
    <script src="../../../../Content/backSys/js/modernizr.min.js"></script>
    <script src="~/Scripts/vue.js"></script>
    <script src="~/Scripts/axios.js"></script>
    <script>

        //向页面添加消息
        function ShowMessage(message) {
            /*$('#list').append('<li>' + message + '</li>');*/
            alert(message);
        }
        function trigger_stay(params) {
            $('#act').val('keep');
        }
        function trigger_update(params) {
            $('#act').val('update');
        }
        function trigger_delete(params) {
            $('#act').val('delete');
        }
        function trigger_add(params) {
            $('#act').val('add');
        }
        //设置cookie
        function setCookie(name, value) {
            document.cookie = name + "=" + escape(value);
            //document.cookie = name + "=" + escape (value)+";path="+"/";
        }
        //设置cookie :value为日期时
        function setDateCookie(name, value) {
            var Days = 30;
            var exp = new Date();
            exp.setTime(exp.getTime() + Days * 24 * 60 * 60 * 1000);
            document.cookie = name + "=" + escape(value) + ";expires=" + exp.toGMTString();
        }
        //获取cookie
        function getCookie(name) {
            var arr, reg = new RegExp("(^| )" + name + "=([^;]*)(;|$)");
            if (arr = document.cookie.match(reg))
                return unescape(arr[2]);
            else
                return null;
        }
        //删除cookie
        function delCookie(name) {
            var exp = new Date();
            exp.setTime(exp.getTime() - 1);
            var cval = getCookie(name);
            if (cval != null)
                document.cookie = name + "=" + cval + ";expires=" + exp.toGMTString();
        }
        function removeNull(data, defaultStr = '') {
            // 普通数据类型
            if (typeof data != 'object' || data == null) {
                if ((data == null || data == 'null')) {
                    return defaultStr;
                } else {
                    return data;
                }
            }
            // 引用数据类型
            for (const v in data) {
                if (data[v] == null || data[v] == 'null') {
                    data[v] = defaultStr;
                }
                if (typeof data[v] == 'object') {
                    removeNull(data[v])
                }
            }
        }

        var commonUtil = {
            /**
             * 弹出消息框
             * param msg 消息内容
             * param type 消息框类型（参考bootstrap的alert）
             */
            alert: function (title, msg, type) {
                if (typeof (type) == "undefined") { // 未传入type则默认为success类型的消息框
                    type = "success";
                }
                // 创建bootstrap的alert元素
                var divElement = $("<div></div>").addClass('alert').addClass('alert-' + type).addClass('alert-dismissible').addClass('col-md-4').addClass('col-md-offset-4');
                divElement.css({ // 消息框的定位样式
                    "position": "absolute",
                    "right": "%50",
                    "top": "%60"
                });

                divElement.text(title); // 设置消息框的内容
                var h = $('<h5><i class="icon-ok-sign"></i>' + msg + '</h5>');
                $(divElement).append(h);
                // 消息框添加可以关闭按钮
                var closeBtn = $('<button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">×</span></button>');
                $(divElement).append(closeBtn);
                // 消息框放入到页面中
                $('body').append(divElement);
                return divElement;
            },

            /**
             * 短暂显示后上浮消失的消息框
             * param msg 消息内容
             * param type 消息框类型
             */
            message: function (title, msg, type) {
                var divElement = commonUtil.alert(title, msg, type); // 生成Alert消息框
                var isIn = false; // 鼠标是否在消息框中

                divElement.on({ // 在setTimeout执行之前先判定鼠标是否在消息框中
                    mouseover: function () { isIn = true; },
                    mouseout: function () { isIn = false; }
                });

                // 短暂延时后上浮消失
                setTimeout(function () {
                    var IntervalMS = 20; // 每次上浮的间隔毫秒
                    var floatSpace = 60; // 上浮的空间(px)
                    var nowTop = divElement.offset().top; // 获取元素当前的top值
                    var stopTop = nowTop - floatSpace;    // 上浮停止时的top值
                    divElement.fadeOut(IntervalMS * floatSpace); // 设置元素淡出

                    var upFloat = setInterval(function () { // 开始上浮
                        if (nowTop >= stopTop) { // 判断当前消息框top是否还在可上升的范围内
                            divElement.css({ "top": nowTop-- }); // 消息框的top上升1px
                        } else {
                            clearInterval(upFloat); // 关闭上浮
                            divElement.remove();    // 移除元素
                        }
                    }, IntervalMS);

                    if (isIn) { // 如果鼠标在setTimeout之前已经放在的消息框中，则停止上浮
                        clearInterval(upFloat);
                        divElement.stop();
                    }

                    divElement.hover(function () { // 鼠标悬浮时停止上浮和淡出效果，过后恢复
                        clearInterval(upFloat);
                        divElement.stop();
                    }, function () {
                        divElement.fadeOut(IntervalMS * (nowTop - stopTop)); // 这里设置元素淡出的时间应该为：间隔毫秒*剩余可以上浮空间
                        upFloat = setInterval(function () { // 继续上浮
                            if (nowTop >= stopTop) {
                                divElement.css({ "top": nowTop-- });
                            } else {
                                clearInterval(upFloat); // 关闭上浮
                                divElement.remove();    // 移除元素
                            }
                        }, IntervalMS);
                    });
                }, 1500);
            }
        };
    </script>


    @if (IsSectionDefined("JavascriptLink"))
    {
        @RenderSection("JavascriptLink");
    }
    @if (IsSectionDefined("Javascript"))
    {
        @RenderSection("Javascript");
    }

</body>






</html>
